home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / comm / mail / ADMail.lha / Install_ADMail < prev    next >
Text File  |  1995-08-31  |  11KB  |  371 lines

  1. ; $VER: ADMail Install Script 1.1 (31.8.95)
  2. ; by Simon Brown
  3.  
  4. ; == Initialize ===========================================================
  5.  
  6. (set appname "ADMail")
  7. (set doc-name "ADMail.guide")
  8. ; == Help Text ============================================================
  9.  
  10. (set #AskFile-help      (cat    "\n  · Use the file requester to select the location\n"
  11.                                 "    on on your hard-disk, where the file resides.\n" ))
  12.  
  13. (set #AskDir-help       (cat    "\n  · Use the requester to select the location (the\n"
  14.                                 "    directory, or partition) where the files(s)\n"
  15.                                 "    should be placed.\n\n"))
  16.  
  17. (set #Main-help         (cat    "\n  · This section of the installation deals with\n"
  18.                                 "    copying the main ADMail executable.\n"
  19.                                 "    The file will be copied to the location\n"
  20.                                 "    previously specified.\n\n"
  21.                                 "  · You are provided with information concerning\n"
  22.                                 "    the version of your current copy (if you have one),\n"
  23.                                 "    in order to ensure you don't accidently overwrite\n"
  24.                                 "    a newer version.\n" ))
  25.  
  26. (set #GuideViewer-help  (cat    "\n  · Select from the list, the viewer you use to\n"
  27.                                 "      display AmigaGuide documents.\n\n"
  28.                                 "  · If the one you use is not listed, select\n"
  29.                                 "    \"Other...\".  You will then be asked to select\n"
  30.                                 "    the one you use.\n" ))
  31.  
  32. (set #Config-help       (cat    "\n  · Fill in the value you require for the option\n"
  33.                                 "    you are being prompted for. Check the guide\n"
  34.                                 "    for more information on each setting.\n\n"
  35.                                 "  · If you don't want to specify a value, accept\n"
  36.                                 "    the displayed default.\n" ))
  37. (set #Makedir-help      (cat    "\n  · ADMail can create a user directory at the\n"
  38.                                 "    indicated location. This directory is where\n"
  39.                                 "    the user configuration file will be kept, and\n"
  40.                                 "    is also the default location for the .signature\n"
  41.                                 "    and header files.\n"
  42.                                 "  · If you answer Yes, the directory will be created\n"
  43.                                 "    (if it does not already exist) and an empty\n"
  44.                                 "    configuration file place within.\n" ))
  45.  
  46. ; == Prompt Text ==========================================================
  47.  
  48. (set #MainLoc-prompt            "Select location for main program file...\n" )
  49. (set #IconLoc-prompt            "Select location for script & icon...\n")
  50. (set #DocLoc-prompt             "Select location for documentation...\n" )
  51.  
  52. (set #GuideViewer-prompt        "Which AmigaGuide viewer?\n" )
  53.  
  54. (set #CopyMain-prompt               "Copying executable...\n" )
  55. (set #CopyGuide-prompt              "Copying documentation...\n")
  56.  
  57. ; == Config file prompts ==================================================
  58.  
  59. (set #basedir-prompt (cat       "\nGive the path to the directory you wish to use for\n"
  60.                                 "the base directory. This will be represented as\n"
  61.                                 "$BASEDIR in all other directory settings.\n"))
  62.  
  63. (set #maildir-prompt (cat       "\nGive the path to the directory where the mailboxes\n"
  64.                                 "are stored.\n"))
  65.  
  66. (set #editor-prompt (cat        "\nGive the name of your favourite text editor -\n"
  67.                                 "include any command line options you think you might need.\n"))
  68.  
  69. (set #sendmail-prompt (cat      "\nGive the name of the program you use to send mail -\n"
  70.                                 "include required command line options, and also\n"
  71.                                 "include \"$MSG\" to indicate the message filename.\n"))
  72.  
  73. (set #makedir-prompt (cat       "\nWould you like a user directory to be created?\n"))
  74.  
  75. ; == Config file defaults =================================================
  76.  
  77. (set #def-basedir               "USR:")
  78. (set #def-maildir               "$BASEDIR/Mail")
  79. (set #def-editor                "$Editor")
  80. (set #def-sendmail              "sendmail <$MSG -f $USER")
  81. ; == Miscellaneous Text ===================================================
  82.  
  83. (set #Welcome-msg
  84.                         (cat    "\nADMAIL INSTALLATION SCRIPT\n\n"
  85.                                 "Thank you for choosing\n"
  86.                                 "ADMail, Amazing Developments Mail.\n"
  87.                                 "\nThis installation script will copy all\n"
  88.                                 "necessary files to your hard-disk,\n"
  89.                                 "and enable you to set the basic\n"
  90.                                 "configuration for your system.\n\n"
  91.                                 "You are advised to have the docs handy,\n"
  92.                                 "if you wish to set any options.\n\n"
  93.                                 ))
  94.  
  95. (set #bad-kick
  96.     (cat "ADMail requires Kickstart 2.04 or greater to run."))
  97. ; == Check KS version =====================================================
  98.  
  99. (if (< (/ (getversion) 65536) 37)
  100.     (
  101.         (abort #bad-kick)
  102.     )
  103. )
  104.  
  105. (set wbversion (/ (getversion "libs:version.library") 65536))
  106.  
  107. ; == Give Welcome message =================================================
  108.  
  109. (message #Welcome-msg)
  110. (welcome)
  111.  
  112. ; == Install the Main Files ===============================================
  113.  
  114. ; Where should I copy the new main files to?
  115.  
  116. (complete 0)
  117.  
  118. (set !MainLocation
  119.     (askdir
  120.         (prompt #MainLoc-prompt)
  121.         (help #AskDir-help)
  122.         (disk)
  123.         (default "SYS:C")
  124.     )
  125. )
  126.  
  127. (set @default-dest !MainLocation)
  128.  
  129. (copylib
  130.     (prompt #CopyMain-prompt)
  131.     (help #Main-help)
  132.     (source "ADMail")
  133.     (dest !MainLocation)
  134.     (confirm)
  135. )
  136.  
  137. (complete 25)
  138.  
  139. ; Where should I put the icon?
  140.  
  141. (set !IconLocation
  142.     (askdir
  143.         (prompt #IconLoc-prompt)
  144.         (help #AskDir-help)
  145.         (disk)
  146.         (default !MainLocation)
  147.     )
  148. )
  149.  
  150. (delete "Read_Mail")
  151.  
  152. (textfile
  153.     (dest "Read_Mail")
  154.     (append (tackon !MainLocation appname))
  155.     (append "\nendcli\n")
  156. )
  157.  
  158. (copyfiles
  159.     (prompt #Main-prompt)
  160.     (source "Read_Mail")
  161.     (dest !IconLocation)
  162.     (infos)
  163. )
  164.  
  165. (complete 50)
  166.  
  167. ; == Install Documentation ================================================
  168.  
  169. ; Where do they want the docs?
  170.  
  171. (set !DocLocation
  172.     (askdir
  173.         (prompt #DocLoc-prompt)
  174.         (help #AskDir-help)
  175.         (default !MainLocation)
  176.         (disk)
  177.     )
  178. )
  179.  
  180. (set !GuideViewer
  181.     (askchoice
  182.         (prompt #GuideViewer-prompt)
  183.         (help #GuideViewer-help)
  184.         (choices
  185.             "MultiView"
  186.             "AmigaGuide"
  187.             "Other..."
  188.         )
  189.         (default (if (>= wbversion 39) 0 1)
  190.         )
  191.     )
  192. )
  193.  
  194. (if (= !GuideViewer 0) (set !GuideViewer "MultiView"))
  195. (if (= !GuideViewer 1) (set !GuideViewer "AmigaGuide"))
  196. (if (= !GuideViewer 2)
  197.     (set !GuideViewer
  198.         (askfile
  199.             (prompt #GuideViewer-prompt)
  200.             (help #AskFile-help)
  201.             (default "SYS:")
  202.         )
  203.     )
  204. )
  205.  
  206. (copyfiles
  207.     (prompt #CopyGuide-prompt)
  208.     (source doc-name)
  209.     (dest !DocLocation)
  210.     (infos)
  211. )
  212.  
  213. (tooltype
  214.     (dest (tackon !DocLocation doc-name))
  215.     (setdefaulttool !GuideViewer)
  216. )
  217.  
  218. (copyfiles
  219.     (prompt @CopyGuide-prompt)
  220.     (source "ADMail.history")
  221.     (dest !DocLocation)
  222. )
  223.  
  224. (copyfiles
  225.     (prompt #CopyGuide-prompt)
  226.     (source "AFD-Copyright")
  227.     (dest !DocLocation)
  228. )
  229. (complete 70)
  230.  
  231. (set !BaseConfig
  232.     (askbool
  233.         (prompt "\n\nDo you wish to set the base configuration?")
  234.         (help "\n\nThis will set up the ENV:ADMail.config file,\n"
  235.             "and copy it to ENVARC: for future use. The base\n"
  236.             "configuration file holds defaults for all the users\n"
  237.             "on your system, and also needs to be set up if you\n"
  238.             "want a base directory other than USR:.\n")
  239.         (default 1)
  240.     )
  241. )
  242.  
  243. (set #basedir
  244. )
  245.  
  246. (if !BaseConfig
  247.     (
  248.  
  249.     (set #basedir
  250.         (askstring
  251.             (prompt #basedir-prompt)
  252.             (default #def-basedir)
  253.             (help #Config-help)
  254.         )
  255.     )
  256.  
  257.     (complete 75)
  258.  
  259.     (set #maildir
  260.         (askstring
  261.             (prompt #maildir-prompt)
  262.             (default #def-maildir)
  263.             (help #Config-help)
  264.         )
  265.     )
  266.  
  267.     (complete 80)
  268.  
  269.     (set #editor
  270.         (askstring
  271.             (prompt #editor-prompt)
  272.             (default #def-editor)
  273.             (help #Config-help)
  274.         )
  275.     )
  276.  
  277.     (complete 85)
  278.  
  279.     (set #sendmail
  280.         (askstring
  281.             (prompt #sendmail-prompt)
  282.             (default #def-sendmail)
  283.             (help #Config-help)
  284.         )
  285.     )
  286.  
  287.     (complete 90)
  288.  
  289.     (textfile
  290.         (dest (cat "ENV:" "ADMail.config"))
  291.         (if (not (= #basedir #def-basedir))
  292.             (append (cat "BaseDir   \"" #basedir "\"\n"))
  293.         )
  294.         (if (not (= #maildir #def-maildir))
  295.             (append (cat "MBoxDir   \"" #maildir "\"\n"))
  296.         )
  297.         (if (not (= #editor #def-editor))
  298.             (append (cat "Editor   \"" #editor "\"\n"))
  299.         )
  300.         (if (not (= #sendmail #def-sendmail))
  301.             (append (cat "Sendmail   \"" #sendmail "\"\n"))
  302.         )
  303.     )
  304.  
  305.     (copyfiles
  306.         (prompt #Main-prompt)
  307.         (source (cat "ENV:" "ADMail.config"))
  308.         (dest "ENVARC:")
  309.     )
  310. ))
  311.  
  312. (complete 95)
  313.  
  314. (set !Makedir
  315.     (askbool
  316.         (prompt #makedir-prompt)
  317.         (help #Makedir-help)
  318.         (default 1)
  319.     )
  320. )
  321.  
  322. (set !user
  323.     (getenv "USER")
  324. )
  325.  
  326. (if (= !user "")
  327.     (set !user "user")
  328. )
  329.  
  330. (if !Makedir
  331.     (
  332.     (if (not (exists (tackon (tackon #basedir !user) "ADMail.config")))
  333.         (
  334.         (textfile
  335.             (dest (cat "T:" "ADMail.config"))
  336.             (append
  337.                 (cat "# " appname " configuration file.\n"
  338.                      "# Check " appname ".guide and fill in the options you need.\n"
  339.                 ))
  340.        )
  341.        (copyfiles
  342.             (prompt #Main-prompt)
  343.             (source (cat "T:" "ADMail.config"))
  344.             (dest (tackon #basedir !user))
  345.        )
  346.  
  347.        (delete
  348.             (dest (cat "T:" "ADMail.config"))
  349.        )
  350.  
  351.    ))
  352.  
  353.    (message (cat "\nUser directory: " (tackon #basedir !user) "\n"))
  354. ))
  355.  
  356. (complete 100)
  357.  
  358. ; == Exit =================================================================
  359.  
  360. (set #Exit-msg          (cat    "\nInstallation complete.\n\n\n"
  361.                                 "Location of program file:\n"
  362.                                 !MainLocation
  363.                                 "\n\nLocation of Document files:\n"
  364.                                 !DocLocation
  365.                                 "\n\n" ))
  366.  
  367. (message #Exit-msg)
  368.  
  369. (exit (quiet))
  370.  
  371.